package lc_2611_老鼠和奶酪;

import java.util.Arrays;

public class Solution {

	public int miceAndCheese(int[] reward1, int[] reward2, int k) {
		Integer[] array = new Integer[reward1.length];
		int ans = 0;
		for (int i = 0; i < reward1.length; i++) {
			array[i] = reward1[i] - reward2[i];
			ans += reward2[i];
		}
		Arrays.sort(array, (a, b) -> b - a);
		for (int i = 0; i < k; i++) {
			ans += array[i];
		}
		return ans;
	}
	public static void main(String[] args) {
		
	}
}